lya: added apply_flat method