fixed issues with main.