Bug fixes, logging changes

Fixed some bugs, updated the logging..
aaa
Revert "aaa"

This reverts commit e13843cb2011c8ad7affee7ea169da9f6e826399.