Fixing bugs 1212 and 1213
Merge pull request #342 from einhverfr/1.4

Fixing bugs 1212 and 1213