Fixing bugs 1212 and 1213

--HG--
extra : source : 6ab5e8432df2be0600c4bc8036db944b82e0dd37
Merge pull request #341 from einhverfr/master

Fixing bugs 1212 and 1213