Fix some reference issues