Added casts to remove compiler warnings.