Bug fixes

closes #215, closes #212, #198