Fixed database session commit bug