Fixes incorrect handling of the declaration context stack.