added checks in to try to find error.