fix segfault for uneven height