Fixed SELECT command on server to make conditionals working