Added explicit type casts. See #2.