bug in checking top/bottom name
fixed minor issues brought up by IntelliJ