Fix magic argspec handling and clean up cd magic and test