use isinstance
fixed sorting by time