bugfix

Bug fix in the last function.