fix for issues 34 and 35

fixes for bug #34 and #35 

/cc @clytwynec @benpatterson