pgr_createTopology: fix cast of record to integer, improve error

Closes #210, superceeds #193
Fixes for test cases related to pull request #213