CVJ-18
fixed bugs
fixed template inheritance for key functions