Bugfix 157 unit of work does not work sometimes

Fix for #157