fix for problem with instanceting from factory function