Fixed some bugs to match the new API updates