Added  better error message when creating form for null object.