Reloading

fixing some bugs with reloading code