Fix a bug in semantic layout connected with negative height calculations