bug fixes and a new generic_magic.py program
minor bug fix