fixed some bugs when commiting a read only tx