Fixed OOB exception in tests