fix boundaries error