Should be pretty obvious, you must have an error in your upper limit conditional.