Several small fixes

@lennartcl