fixed permissions check