Smal fixes and bugs