fix random function and autoloading of pictures