fix fileobj type checking