update insert references only if visibility changes
improve error handling in AjaxModel