fixing the mysterious argument out of range exception