Fix reference to non-object