Fix undefined bug