Fixed some errors caused by latest merge