Bug fixing and other stuff