Fixed getDate function.