Fixed bugs due to restructuring.