several macro and widget fixes

handling border cases correctly