internalfunction factory fix

@rbsloot