Fixed an issue with trash that could cause a crash