Added the patch provided by Romjerome to handle the emptyness of media_directory.
Corrected the test database