Some fixes etc. to bktool and aftool