remove error prone usage of directive and add error check