Fixed all the minor bugs