fixed a bug with horizontal layout template