bug fixing and tuning