libframes: corrected some errors, add tests