Added additional check which may or may not fix #442.