fix bug for tilesize != 256