removed casts and fixed the timestamp conversion