amirite: fix some warning and performance issues