complicated lock handling, fixes #227
Merge branch 'indigo' into hydro-devel