fixed bug for nullpointer in form
some style changes and bug fixes