added command handler on finished event in lib/stream