fix and refactor debug toolbar