adding some check for bad credentials