fixed the final bugs