Hotfix/static analysis fixes

Just some minor hotfixes after doing static analysis over the codebase.

Couldn't run the complete test suite since agents seem to be disabled for my account.