You really should be using the stdlib function str2bool