fixed some bug with calendar