CRM-12856 hack to stop problems arising from mis-use of locks - need to review correct approach