changed to conditionally define boolval() function so this will work
with the latest php but stay compatible with previous php, too