modified strappend() to return an int