Brakeman fixes

Fix issues (mostly false positives) highlighted by brakeman.