fixed input being sent twice and fixed buffer bug in server