Corrected all bugs