Fixed a number of unclean build issues