some improvments and fixes