Fix study manager study definition update + various small fixes