fix defines & cleanup