fixed functions to work on lists