add preliminary test cases and minor fixes in the form context