add capfile and little bugs fix