implement extends_callback to support template inheritance