fix delete element from generic list

add flag for debug