Fix several errors