some fixes and code imrpv