fixed a bug in a directive controller