fixes #4604

If class contains constructor addFunction will no longer result in an error.  This fixes issue #4604