Fixed references bug

Adding a new function to fix the  type bug in the calendar.pt template