Fix possible TypeError