Fixed ESDS bugs
Everything from branch 'next'