Fixed the update command. Added more robustness to it.