added if's to goodness, hopefully it fixes the out of bounds exception.