properly validate className and return null if not possible. fix #386