Fixing errors in DB update routines