added toLong cast function