slight optimization
a few more define fixes