handle empty frames correctly