fixed ERROR macro and couple other minor tweaks