Issue40

Fixes #40 

Not tested, but should work :)