fixing key error stuff