more fix on mainfunction