fixed minor bug when creating directive