Bug Fix

Bug correction and functions check