Utilities: Fix issue with keyerror