Fixed tests and a bug with contexts.