fixed a bug by cleaning code