fix end_time check when nil
add missing tests