ElementFactory test and fixes