Fix the set context return code, add more debug to help plugin development.