updated to fix new problems introduced by scipy