Fix all compiler errors and warnings