Fixed some remaining bugs