Fixing directories. Added test for it too.