Modified to ensure exception on key not found