Fixes for two show stoppers

Dams that third commit with the cr/lf hack was not supposed to be part of this pull request. But if you like it, feel free to merge it ;)