Fixed crash that happened from time to time.

It's a surprise it didn't happen more often...