Fixed bug in setDate functions