core: check the right variable for failed open()