Fixed referencing issue in chat controller