fixes #5807 Error in console when you refresh the Action Panel

Fixed the issue and pushed the code for review, please check it.