Little improvements to make it work in a subcontext