Fix the --always-copy bug (with new unit test)

This fixes the ``IOError`` bug with mentioned in issues #495 and #344, I've also added a unit test.