correct undefined errors