setting default failed_attempts to 0 and removing debug code