lot of fixes and imp