Added listener to set path automatically