Fixed compiler errors and some warning.