added inversing to fix routine