Fixed errors in listener