Fixed potential crash caused by missing require 'pathname'