Fixed some weirdness in computing shapes.