Fix undefined errors