fix template sub directory missing bug