fixed various bugs prior to Pull Request 19