Fix numeric conversions in lua script for offset base