modefied origin version, which has bugs