Fixes two little potentional bugs:

- $connection should be true or false, however mysql returns -1 in special cases. So it's better to check the type too to avoid any false positives
- import_firstpost should be an integer, so cast it to one