fixed defects in element generation