Fixed issues with references