Fix permission handling, improve ansi