Fix bug that may have caused a crash