main: remove tail call. fix commonpath