bugfix + improvements