g bash function fix