Fix non-object error