Lots of basic bug fixes for compile errors