Fixes layouting for different number of items

Fixes issue #14