fixed bug with dimensions
try to avoid computations if we can
fixed generation of tables