Added extra check for empty credentials