Fixed memory leak while handler clearing. Now the whole map is cleared.