fix bugs and add stubfile