Fix compile errors and makes HTMApplet working