check type before pop