Fixed get last day of month function