fixed buildraw.py to Chris' version with some fixes