Fixed the condition-handling

I have to changed the order from the addListener and now it works.