Added a condition in popEvent() ---Aastha