add explicit casts for the ptrdiffs