fix build errors / tidy up