fixed broken function