correct code and fix bugs