fixed inject in normal (non-delegated) templates, and added test case