Fixed bug in directive