Add extra precautions to help fix #1187