fixed logging and permission errors