fixed open to return correct fd