add main option and some fixes