added code to restore functions