fixed error with references to local objects