Fix a logic bug in player class
Fix a potencial crash in player class