bugfix and removal of obsolete function