Fixed compile errors and other problems.