profile and some fixes