fixed indexoutofbounds