Corrected two bugs