fixed some reference issues