fixed getting max time

also metadata stuff