use typeof "function"
fixed; model.remove() removes only what is necessary

fixes #1649