function bug's solved; new bug found (struct allocation missing -> NULL pointer) but bypassed for now