Fixed final bugs