Fixed compiler errors and warnings