Fixing issues related to #210 and #208

Please review, make sure I didn't do anything "weird".