fixed a bug for multiple instance