add casts to avoid 64bit compilation warnings that were treated as errors