added new method and fixed a bug