fix allocation check