trying to fix error of non object