added stderr support and fixed some parsing issues