fix errors and pretty printed