fixing debug and formatting