Fixed dgesv typo and changed linking flag order