Fix bugs/issues found by Scrutinizer
Removed test that didn't test much and could false-ly fail sometimes.