cosmetics
Add null check and initialization code
Suppress unnecessary processing
Add the necessary seek operation for m2ts

Fix #1 and #3.