Closes #413
Some fixes. Info given by Scrutinizer