Fixed #197, #250, and #233