fix error in debug mode, clean formatting