fixed bug in update statement