Fixed minor bug and improved stream initialisation