fixed many functions