Fixed bugs frof previous commits