Fix path.join and similar bugs