Fix up some cocked up functions