Fixed some bugs with the new functions.