fix add/edit view, some model changes and some minor bug fixes