fixes in handling filedescriptors with a non-empty read buffer