fixed bug in profile function