added function to check if you lost