Fixing 'undefined property'