corrected def #{func_name} so that it wont return last element