Better Windows support: fixes issues #12 and #13