Bug fixes and improvements

Not sure if this is maintained anymore, but out of box I ran into several issues. This PR resolves three of them. See commit messages for more details.