Fixing issues related to #210

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