fixing bounds bug