improved check for main file