Fixed some reference issues