Tidying up some bugs