fixed a bug in stream-for-n-steps