some fixes and improvments