Added check in c code