fixing the returns value for functions 'scan' family