Fix path replacement for device mode