fixed an error where list was appending incorrect values