Bug fixes previous merge