Fixed #27

This is a small change that fixes #27 for me. 

I haven't been able to reproduce this with a simple sample project, and I can't share the code I'm using unfortunately, but I think it's a pretty safe change.

If you do want to merge this and you would like a sample project first, let me know and I will try to reproduce. I'm not sure when I'll get a chance to do so though.