fixed undefined variable
fixed null value in strict sql mode