Fix a few small bugs, closes #2