Add function to check output data lenght