tested and resolved bugs in angular directive