Added pid directory creation.