fix the logic for MYAPPID, add a test