calculate entropy in base 2
fix casting problems
reverting on wrong count