remove old code, fix some issues