added if condition when update is called

added if condition when update is called