added check for main as suggested in #2