lots of changes regarding references check