Fixed regression bugs