Added explicit type casts to prevent warnings.