some fixes and dirty workarounds