replace broken check to hopefully fix #562