Added ping method, fixed stream bug