Fixed all the remaining bugs