Trying to fix None key error