Fix compilation bugs