added wrprintf and small fixes