fix bug in labels length conditional test