fix some issues. not finished. I am not sure about something.