better filedescriptor handler