Fix undefined attrs bug