several bug fixes over the time