Several improves and fixes