Many fixes and little improvements