corrected bounds handling