a lot of fixes and bugs due to latest additions