bug fixes with keyerrors