fixed #1 fixed #2 fixed #4