Fix #188 and more things found during testing