fix #1 and #2 and #4 and #5  a