some fixes and small improvements