Fix the error ArgumentOutOfRangeException reported by @fprochazka, @matej21. Thanks