code cleanup
fixed warnings found by splint