fixed infinit loop