check cmd obj is valid before setting rcfile