Fix fatal error when trying to open a non-existent directory