Replaced fopen with open. Hopefully fixes issue #12