Fixed bug on FLATTEN and LIMIT