added typesafe write methods