fix for 32bit architectures
remove warning and  simplify codes