Fixed some private access violations
Fixed another bug with references