fixes entropy calculation (thanks to @LennyLinux)