add working buttonmode, fix some mistakes