Bug fix on update functionality