Use (int) for typecasting instead of intval(). Closes #3363

Thanks again @aswinlutchanah for the hint.