fixed several bugs. There is still one bug I know of:
The edit view fails if data is not set