fix bug with references and naming