added safeJoin