inline substitute function