Fixing type casting to fix compiler warning