fxed a bug when empty string provided