Bug fixes

closes #213