fix 0 pointer error