Fix undefined property error