Fixed bugs from previous merge.