review demo code and fix some issue