Fixed an issue that could cause crashes