Fixed key error bug