fixed the boundary bug!!!!