Bug correction and old code left deleted