correct code and bugs