fixed exception bug in cutStringAt