changed username variable in check function to name