fixed keyerror