[Issue #1539] Adding casts to suppress compiler warnings