Conformed transferVariable() to API

Changed conditional debug output to print_debug method calls.  Added
saving and restoring $db,$proj.