Fix a bug in the rgloader