Fixed lots of ArrayIndexOutOFBounds exceptions, fixed #100 and some
others