Change attribute check to work properly