Corrected bug that could cause random crashes