fixed incomplete function