functions: handle gerror