finally solved a bug