make it work correctly with folders