Fixed several initialization bugs (firefox and random) and improved
memory deallocation