Fix bug that caused "Non-string key given" exception.