fixed bug with wrong reference