Fix sub-context lookups

Fix https://github.com/codeparty/derby/issues/324