fixed assign function