fixed bug with multi-level extends.