check val before substr