Magnetocaloric effect and critical behavior in Pr0.5Sr0.5MnO3: an analysis of the validity of the Maxwell relation and the nature of the phase transitions