Added an assertion into the pop operation. Improvement over error