add explicit int64_t casts

OS X has trouble deciding between an int and int64_t in these cases.

Closes #2148.