Fixed a bug in difficulty calculating