corrected problematic functions