changed match_ended to not be fucked up