fixed bugs

square motion and duplicate function