fixed to use NIO