Some changes and fixes and test