Fix several small issues

@lennartcl