Fix small error: trying to get property of non object