fixed a call to flatten vs flat