Fix array key not existing error