Fixed pointer-not-allocated error