added support for reading files non-blocking