bug fix in connection with functions