write method for cursor