fixed github issues 1, 2, 4, 8, and 18.