Cast timestamp to integer - bug