These casts should fix the warnings on OS X.