Corrected a couple of bugs