Fix for a bug on rotated tables