improve guards in megaup.py