fixed a bug with the boundaries in move method