fixed popping functionality