cleanup & fix compile errors