A couple of fixes

First commit is just for silencing a compiler warning. Second one fixes a logic error inside an if condition. Please, see the commit message for the details.