fix #6404
check length() of Int64 ranges on 32-bit. hopefully fixes #6396
fix #6431 (more reverse-i-search problems)