Fixes all bugs to pass all tests suite for E3 deliverable. However, E2 t...

...ests suite still doesn't work with new allocate_DIR() implementation