added workaround for stupid java.nio bug