fixed movebuffer over-running the end of the array