Various code fixes

Due to earlier refactoring by renaming, the listener did not work
anymore. Fixes to make the listener work again.