fix mac compilation, some small improvements for mac, bugfixes in tickets