added error callback to pop so that this stack can be reused