remove debug code, fix obvious bug