Fixes incorrectly set error_occured and improves speed Signed-off-by: Michael Niedermayer <michaelni@gmx.at>