Fixed a few functions