Added to ioctl, solved some locking problems.