Fixed bugs in home/end key movement.