added cubes textures support
fixed invalid optimization