add shebang to main file and bug fix parts of the new media library