Bug fixes; return to initial directory after plotting