Fixed some bugs in optimistic. Tested with IBM DB2.