fixed some errors in the update procedure