Fixed some bugs before submitting