Fix errors about undefined properties