Minor fixes

Just some minor fixes I made while reviewing parts of the code, check the commits log.