small fixes and gradle scripts factoring