added error handling of move
added error handling of move