Be more defensive when checking ls