Fix percentage typecasting

This branch fixes an issue with typecasting in the percentage based gates when used with flipper-redis adapter. See commits for more details. Any input welcome!