Fixing credentials check to use length instead of nil