fix EOF handling
fix boundary condition
fix pipeline handling