Added test case for update command, fix bugs