Moving variable declaration in block in api/chan