Improved logging
adapted better to hibernate behavior