Added castings to fix compiler warnings.