fix compile errors and other stuff