Add allocation checks around more things