- fixed if clause for update
- fixed assert for last state
- improved selftest