fixes to struct related functions