fix trash data at end when duration metadata is incorrect

see #11