some fixes and improvment