a lot of bugfix