Switching from replace to splitext to prevent matplotlib barfs