adding elseif seems to bring problem so changed to IF