popping elements bug fixed