fix bug in difficulty loop