Bugfixes

Both scripts had logic errors and typos. Fixed, smoothed out. Good.