Attempt to fix non-object error