Fixed bug in listener