Fix #247 The 2nd argument to dir() is not required

Made 2nd argument optional by adding default null value. Resolves #247.