fixing undefined errors