fix order to functions to please gcc gods