Fix signedness and handle optional variable better (#4085)
Merge pull request #4086 from dschwen/dbgwarn_4085

Fix signedness and handle optional variable better
Merge commit 'b6cedecd61d5c0c76d1611ed83038f97b4150f72'