catch ValueError, fixed issue #321