Fix #1488 and other minor layout improvements