Fix a bug pointed out by Riking.