add read invalid fd checks