cleanups
fix permissions handling